package com.solairen.myapplication.Pager.LoginPager;



import android.app.Dialog;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import androidx.fragment.app.DialogFragment;

import com.solairen.myapplication.Pager.LoginPager.LoginNameActivity;
import com.solairen.myapplication.R;


public class CustomDialogFragment extends DialogFragment {

    @NonNull
    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {
        AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
        View view = getActivity().getLayoutInflater().inflate(R.layout.fragment_register_success, null);
        builder.setView(view);

        TextView textView = view.findViewById(R.id.textView);
        Button button = view.findViewById(R.id.button);
        textView.setText("注册成功");

        // 点击后跳转到ActivityA
        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss(); // 关闭对话框
                Intent intentToActivityA = new Intent(getActivity(), LoginNameActivity.class);
                startActivity(intentToActivityA); // 启动ActivityA
            }
        });

        return builder.create();
    }
}